import pyautogui
pyautogui.FAILSAFE = True


def clickToDownload():
    # 进入详情准备下载
    pyautogui.click()
    # 移动到下载按钮的位置
    pyautogui.moveTo(370, 680, 1)
    pyautogui.click()
    # 在弹框中选择对应分辨率并下载
    pyautogui.move(0, -315, 1)
    pyautogui.click()
    # 选择720p的分辨率
    pyautogui.move(0, 100, 1)
    pyautogui.click()
    # 开始下载
    pyautogui.move(0, -25, 1)
    pyautogui.click()
    # 返回操作
    pyautogui.moveTo(10, 10)
    pyautogui.click()


# pyautogui.moveTo(10, 10, 1)
# pyautogui.click()
if __name__ == '__main__':
    # 显示的第一个cell 的位置
    for i in range(1):
        pyautogui.moveTo(170, 300)
        clickToDownload()
        # pyautogui.moveTo(10, 10, 1)
    # 移动到右边cell
        pyautogui.moveTo(570, 300, 1)
        clickToDownload()
        # 滑动一个cell 宽度
        pyautogui.moveTo(170, 300, 1)
        pyautogui.scroll(-240, 2)

    # clickToDownload()
    # pyautogui.moveTo(570, 300, 1)
    # clickToDownload()
